//
//  VodDownLoader.h
//  VodSdk
//
//  Created by gs_mac_fjb on 14-10-31.
//  Copyright (c) 2014年 gensee. All rights reserved.
//

#import <Foundation/Foundation.h>
//#import "VodItem.h"
//#import "downItem.h"
@class downItem,VodItem;
#include "vodHead.h"
@protocol VodDownLoadDelegate;
@interface VodDownLoader : NSObject
@property(nonatomic,assign)id<VodDownLoadDelegate>  delegate;
@property(nonatomic,strong)NSString *mCurrentDownloadId;


/**
 * 初始化
 */
- (id)initWithDelegate:(id<VodDownLoadDelegate>)delegate;


/**
 * 开始下载
 */
- (void)Downlod:(downItem*)vodItem;

- (void)start:(NSString*)DownloadId;
/**
 * 删除item
 */
- (BOOL)delete:(NSString*)DownloadId;

/**
 * 暂停item
 */
- (void)stop:(NSString*)DownloadId;
/**
 * 添加列表 
 * param domain  域名
 * param number  编号
 * param loginName  登录名
 * param vodPassword  点播观看密码
 * param loginPassword  点播登录密码
 * param downFlag  1:需要下载  0:不需要下载  用于在线播放和下载播放
 * param serType  : webcast  ,training
 */

- (void)addItem:(NSString *)domain
         number:(NSString*)number
      loginName:(NSString*)loginName
    vodPassword:(NSString*)vodPassword
  loginPassword:(NSString*)loginPassword
       downFlag:(int)downFlag
        serType:(NSString*)serType;

/**
 * 添加列表
 * param domain  域名
 * param number  编号
 * param loginName  登录名
 * param vodPassword  点播观看密码
 * param loginPassword  点播登录密码
 * param vodid  点播ID 主要针对点播id来进行获取
 * param downFlag  1:需要下载  0:不需要下载  用于在线播放和下载播放
 * param serType  : webcast  ,training
 */

- (void)addItem:(NSString *)domain
         number:(NSString*)number
      loginName:(NSString*)loginName
    vodPassword:(NSString*)vodPassword
  loginPassword:(NSString*)loginPassword
          vodid:(NSString*)vodid
       downFlag:(int)downFlag
        serType:(NSString*)serType;

/**
 * 插入数据库item
 */
- (void)addItemToDataBase:(downItem*)item;

/**
 * 获取下载路径
 * vid :downloadid
 */
- (NSString*)VodDownLoadPath:(NSString*)DownloadId;

@end

@protocol VodDownLoadDelegate <NSObject>

- (void) onDLFinish:(NSString*) downLoadId; // 下载完成

- (void) onDLPosition:(NSString*) downLoadId  percent:(float) percent; // 下载进度

- (void) onDLStart:(NSString*) downLoadId; // 下载开始

- (void) onDLStop:(NSString*) downLoadId; // 下载停止

- (void) onDLError:(NSString*) downLoadId Status:(VodDownLoadStatus) errorCode; // 下载出错

- (void) onAddItemResoult:(RESULT_TYPE)resoultType voditem:(downItem*)item;
@end
